<?php

class EmailsService {

	public $dbutil;
	
	function __construct($dbutil){
		$this->dbutil =  $dbutil;
	}
	
	 public function getEmailsByEmail($email) {
        $sql = "SELECT * from emails WHERE  email = '".$email."'";
        $result = $this->dbutil->get_results ( $sql );
        if(count($result) > 0){
        	return $result[0];
        }else{
        	return null;
        }
    }
    
    public function addEmail($email,$email_origin){
    	$sql = "insert into emails (email,email_origin,create_date) values ('".$email."','".$email_origin."',sysdate())";
		return	$this->dbutil->query($sql);
	}
	
}
?>